<?php
/**
*Smarty plugin
*@package Smarty_ams
*@subpackage plugins
*
*@author:Liu Zhongjie<neojie@263.net>
*@coperation:Beijing Arouter Software Co.Ltd
*@creat Date:2007/07/31
**/

/**
* Smarty {html_total_ams} function plugin
*
* Type:    function<br>
* Name:    html_total_ams<br>
* Date:    July 31,2007<br>
* Input:<br>
*         -total = 总数
*         -msg   = 文字信息
* Examples:
* <pre>
* <{html_total_ams total=$TOTAL totalmsg=$TOTALMSG}>
* </pre>
* @param array
* @param Smarty
* @return string
**/

function smarty_function_html_total_ams ($params, &$smarty)
{
	require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
	
	$iTotal = 0;
	$sMsg   = null;
	
	foreach($params as $_key => $_value)
	{
		switch($_key)
		{
			case 'total':
                $iTotal  = (int)$_value;
                break;
            case 'totalmsg':
             	$sMsg    = (array)$_value;
            	break;
            default:
            	$iTotal  = "";
            	$sMsg    = "";
            	break;
		}
	}
	$sOutput     = '<table width="100%" border="0" style="font-size:12px;">'."\n";
	$sOutput    .= '<tr>'."\n\t";
	$sOutput    .= '<td width="100%" align="right">'."\n\t\t";
	$sOutput    .= '<font style="font-size:12px;">'.smarty_function_escape_special_chars($sMsg["total"]).'</font>'."\n\t\t";
	$sOutput    .= '<font style="font-size:12px;color:red;">'.smarty_function_escape_special_chars($iTotal).'</font>'."\n\t\t";
	$sOutput    .= '&nbsp;&nbsp;';
	$sOutput    .= '</td>'."\n";
	$sOutput    .= '</tr>'."\n";
	$sOutput    .= '</table>'."\n";
	
	return $sOutput;
	
}
?>
